/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import java.util.ArrayList;
import java.util.HashMap;
import model.*;

/**
 *
 * @author isen
 */
public interface PersistenceInterface {

    public boolean createUser(User user);

    public boolean deleteUser(String name);

    public User readUser(String name);

    public boolean updateUser(String name, User user);

    public boolean checkCombination(String username, String password);

    public boolean isClient(String username);

    public boolean createProduct(Product product);

    public boolean deleteProduct(String name);

    public Product readProduct(String name);
    
    public Product readDetailsProduct(String name);
    
    public boolean productExists(String name);
    
    public int getCurrentCartId(String clientname);

    public boolean updateProduct(String name, Product product);
    
    public String getAdress(String clientname);
    
    public String getPaymentform(String clientname);
    
    public ArrayList<Integer> getTransactionIds();
    
    public HashMap<String,Product> getProducts();

    public boolean addProductToShoppingCart(String productname, int quantity, int cartid);
    
    public int hasAShoppingCartUnpaid(String username);
    
    public boolean cartIsEmpty(int cartid);
    
    public boolean setPaid(int cartid); 
    
    public int nextCartId();
    
    public boolean createACart(Cart cart);
    
    public boolean isAlreadyAdded(int cartid,String productname);
    
    public boolean updateQuantityOfACart(int cartid, String productname,int newamount);
    
    public int getAmountFromACart(int cartid, String productname);
    
    public int getStock(String productname);
    
    public double getPriceOfAProdcut(String productname);
    
    public ArrayList<CartContent> getCartContents(int cartid);
    
    public double getFinalPrice(int cartid);
    
    public Transactions getTransaction(int transactionid);
    
    public int getTransactionID(int cartid);
    
    public boolean createTransaction(int cartid, String clientname, double finalprice);
            
    public boolean setUp(String url, String driver, String user, String password);

    public boolean disconnect();
    
    public User getUser(String username);
}
